<!DOCTYPE html>
<html lang="zh-CN">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>给李艾泽的表白</title>
    <style>
        body {
            margin: 0;
            padding: 0;
            width: 100vw;
            height: 100vh;
            background-color: #f5f5f5;
            overflow: hidden;
            font-family: "SimHei", sans-serif;
            user-select: none;
        }
        .container {
            position: relative;
            width: 100%;
            height: 100%;
        }
        .window {
            position: absolute;
            width: 60px;
            height: 40px;
            border: 1px solid #ccc;
            border-radius: 3px;
            overflow: hidden;
            background-color: #fff;
            box-shadow: 2px 2px 3px rgba(0,0,0,0.1);
            margin: 2px;
            transition: all 0.3s ease;
        }
        .title-bar {
            height: 14px;
            background-color: #eee;
            padding: 0 4px;
            display: flex;
            align-items: center;
            gap: 2px;
        }
        .title-bar .btn {
            width: 7px;
            height: 7px;
            border-radius: 2px;
        }
        .title-bar .min { background-color: #ffd591; }
        .title-bar .max { background-color: #b5e61d; }
        .title-bar .close { background-color: #ff6b6b; }
        .content {
            padding: 4px;
            font-size: 10px;
            line-height: 1.2;
            height: 26px;
            display: flex;
            align-items: center;
            justify-content: center;
            color: #333;
        }
        @media (max-width: 768px) {
            .window { width: 55px; height: 38px; }
            .content { font-size: 9px; }
        }
    </style>
</head>
<body>
    <div class="container"></div>

    <script>
        const textList = [
            "李艾泽，开心最重要",
            "李艾泽，要记得多穿衣服",
            "李艾泽，我想你了",
            "李艾泽，记得好好吃饭哦",
            "李艾泽，你很重要",
            "李艾泽，不开心可以找我聊天"
        ];
        const finalText = "李艾泽我喜欢你";
        const appearSpeed = 250;
        const container = document.querySelector(".container");
        const screenW = window.innerWidth;
        const screenH = window.innerHeight;

        function generateOrderedHeartPoints() {
            const points = [];
            const scale = Math.min(screenW, screenH) * 0.028;
            const centerX = screenW / 2;
            const centerY = screenH / 2 + 10;

            for (let t = 0; t < 2 * Math.PI; t += 0.12) {
                const x = 16 * Math.pow(Math.sin(t), 3);
                const y = -(13 * Math.cos(t) - 5 * Math.cos(2 * t) - 2 * Math.cos(3 * t) - Math.cos(4 * t));
                points.push({ x: centerX + x * scale, y: centerY + y * scale });
            }
            return points;
        }
        const heartPoints = generateOrderedHeartPoints();
        const totalWindows = heartPoints.length;

        function createWindowByHeartOrder(pointIndex) {
            const targetPoint = heartPoints[pointIndex];
            const isFinalWindow = pointIndex === totalWindows - 1;
            
            const windowEl = document.createElement("div");
            windowEl.classList.add("window");
            
            const bgColors = ["#fce4ec", "#e1f5fe", "#e8f5e9", "#fff3e0", "#f3e5f5"];
            windowEl.style.backgroundColor = isFinalWindow ? "#ffc1e9" : bgColors[Math.floor(Math.random() * bgColors.length)];
            windowEl.style.zIndex = isFinalWindow ? 999 : pointIndex;

            const displayText = isFinalWindow ? finalText : textList[Math.floor(Math.random() * textList.length)];
            windowEl.innerHTML = `
                <div class="title-bar">
                    <div class="btn min"></div>
                    <div class="btn max"></div>
                    <div class="btn close"></div>
                </div>
                <div class="content">${displayText}</div>
            `;

            const enterOffset = 50;
            windowEl.style.left = `${targetPoint.x - 27.5}px`;
            windowEl.style.top = `${targetPoint.y - 19}px`;
            container.appendChild(windowEl);

            setTimeout(() => {
                let floatTimer = setInterval(() => {
                    windowEl.style.left = `${targetPoint.x - 27.5 + Math.random() * 3 - 1.5}px`;
                    windowEl.style.top = `${targetPoint.y - 19 + Math.random() * 3 - 1.5}px`;
                }, 200);
                setTimeout(() => clearInterval(floatTimer), 2000);
            }, 100);
        }

        for (let i = 0; i < totalWindows; i++) {
            setTimeout(() => createWindowByHeartOrder(i), i * appearSpeed);
        }
    </script>
</body>
</html>